Use case: Full duplex transmission/reception in polling mode ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
#define DATA_TO_SEND 256
#define DATA_TO_RECEIVE DATA_TO_SEND
SPI_HandleTypeDef hspi1;
uint8_t aTxBuffer[] = "*** SPI communication based on Polling mode***"
uint8_t aRxBuffer[BUFFERSIZE]
HAL_SPI_Transmit(&hspi1, aTxBuffer, DATA_TO_SEND, 500);
HAL_SPI_Receive(&hspi1, aRxBuffer, DATA_TO_RECEIVE, 500);
HAL_SPI_TransmitReceive(&hspi1, (uint8_t *)aTxBuffer, (uint8_t *)aRxBuffer, BUFFERSIZE, 500);
|
#define DATA_TO_SEND 256
#define DATA_TO_RECEIVE DATA_TO_SEND
hal_spi_handle_t hspi1;
hal_spi_config_t spi_config;
uint8_t aTxBuffer[] = "*** SPI communication based on Polling mode***"
uint8_t aRxBuffer[BUFFERSIZE]
HAL_SPI_Transmit(&hspi1, (const void *)pTxData, DATA_TO_SEND, 500);
HAL_SPI_Receive(&hspi1,( void *)aRxBuffer, DATA_TO_RECEIVE, 500);
HAL_SPI_TransmitReceive(pSPI, pTxData, &RxBuffer, BUFFER_SIZE, 500);
|
Key changes ¶
HAL2 uses
hal_spi_handle_tinstead ofSPI_HandleTypeDef.

